#pragma once

#define	OPZNET_SERVER_DLL

#ifdef _DEBUG
	#define OPZ_DEBUG_MEMORY
#else
	#define OPZ_REDIRECT_NEWDELETE
#endif

#include "../common.h"
#include "../profiler.h"
#include "opznet/server.h"

namespace opznet
{
	struct unicast_packet_t
	{
		vector<char>	data;
		ID				clientId;
	};

	struct multicast_packet_t
	{
		vector<char>	data;
		vector<ID>		client_id_vector;
	};

	enum req_type_t
	{
		TCP_UNICAST_REQ,
		UDP_UNICAST_REQ,
		MULTICAST_REQ,
		DISCONNECT_REQ
	};

	struct req_t
	{
		req_type_t			type;
		unicast_packet_t	uni;
		multicast_packet_t	multi;
		ID					client_id;
	};

	typedef BufPool<req_t>::Buf<req_t>	req_buf_t;
	#define REQ_POOL	BufPool<req_t>::Instance()
	
	typedef BufPool<server_msg_t>::Buf<server_msg_t>	msg_buf_t;
	#define MSG_POOL	BufPool<server_msg_t>::Instance()

	extern opzSafeQueue<req_buf_t *>	req_queue;
	extern opzSafeQueue<msg_buf_t *>	msg_queue;
}